import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-system/tenant/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/blade-system/tenant/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const getAuthDetail = (tenantId, userNo, userType, id) => {
  return request({
    url: '/api/rb-core/core/auth/auth_examine/detail',
    method: 'get',
    params: {
      tenantId,
      userNo,
      userType,
      id
    }
  })
}

export const getBankDetail = (tenantId, userNo, userType, id) => {
  return request({
    url: '/api/rb-core/core/bank/bank_examine/detail',
    method: 'get',
    params: {
      tenantId,
      userNo,
      userType,
      id
    }
  })
}

export const getAisleAllList = (current, size, userNo, userType) => {
  return request({
    url: '/api/rb-core/core/aisle/pay_aisle/list',
    method: 'get',
    params: {
      userNo,
      userType,
      current,
      size,
    }
  })
}

export const getAisleOemList = (tenantId, userNo, userType) => {
  return request({
    url: '/api/rb-core/core/aisleOem/aisle_oem/list',
    method: 'get',
    params: {
      tenantId,
      userNo,
      userType
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/blade-system/tenant/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

/* 基本信息 新增/修改 */
export const add = (row) => {
  return request({
    url: '/api/blade-system/tenant/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/blade-system/tenant/submit',
    method: 'post',
    data: row
  })
}

/* 实名信息 新增/修改 */
export const authAdd = (row) => {
  return request({
    url: '/api/rb-core/core/auth/auth_examine/submit',
    method: 'post',
    data: row
  })
}

export const authUpdate = (row) => {
  return request({
    url: '/api/rb-core/core/auth/auth_examine/submit',
    method: 'post',
    data: row
  })
}

/* 结算卡信息 新增/修改 */
export const bankAdd = (row) => {
  return request({
    url: '/api/rb-core/core/bank/bank_examine/submit',
    method: 'post',
    data: row
  })
}

export const bankUpdate = (row) => {
  return request({
    url: '/api/rb-core/core/bank/bank_examine/submit',
    method: 'post',
    data: row
  })
}

/* 支付通道信息 新增/修改 */
export const aisleAdd = (row) => {
  return request({
    url: '/api/rb-core/core/aisleOem/aisle_oem/submit',
    method: 'post',
    data: row
  })
}

export const aisleUpdate = (row) => {
  return request({
    url: '/api/rb-core/core/aisleOem/aisle_oem/submit',
    method: 'post',
    data: row
  })
}

/* 政策分润配置信息 新增/修改 */
export const oemPolicyAdd = (row) => {
  return request({
    // url: '/api/rb-core/core/oempolicy/oem_policy/submit',
    url: '/api/rb-core/core/oempolicy/oem_policy/submitV2',
    method: 'post',
    data: row
  })
}

export const oemPolicyUpdate = (row) => {
  return request({
    // url: '/api/rb-core/core/oempolicy/oem_policy/submit',
    url: '/api/rb-core/core/oempolicy/oem_policy/submitV2',
    method: 'post',
    data: row
  })
}

export const setting = (ids, form) => {
  return request({
    url: '/api/blade-system/tenant/setting',
    method: 'post',
    params: {
      ...form,
      ids
    }
  })
}

export const datasource = (tenantId, datasourceId) => {
  return request({
    url: '/api/blade-system/tenant/datasource',
    method: 'post',
    params: {
      tenantId,
      datasourceId
    }
  })
}

export const info = (domain) => {
  return request({
    url: '/api/blade-system/tenant/info',
    method: 'get',
    params: {
      domain
    }
  })
}

export const packageInfo = (tenantId) => {
  return request({
    url: '/api/blade-system/tenant/package-detail',
    method: 'get',
    params: {
      tenantId
    }
  })
}

export const packageSetting = (tenantId, packageId) => {
  return request({
    url: '/api/blade-system/tenant/package-setting',
    method: 'post',
    params: {
      tenantId,
      packageId
    }
  })
}

/* 模板政策列表 */
export const templatePolicyList = (aisleCode) => {
  return request({
    url: '/api/rb-core/core/oempolicy/oem_policy/templateList',
    method: 'get',
    params: {
      aisleCode
    }
  })
}

/* 模板政策一键填入赋值 */
export const templatePolicyDetail = (polNo, tenantId, userNo, userType, id, aisleCode) => {
  return request({
    // url: '/api/rb-core/core/oempolicy/oem_policy/templateDetail',
    url: '/api/rb-core/core/oempolicy/oem_policy/templateDetailV2',
    method: 'get',
    params: {
      polNo,
      tenantId,
      userNo,
      userType,
      id,
      aisleCode
    }
  })
}

/* 通道政策详情 */
export const getPolicyDetail = (tenantId, userNo, userType, aisleCode) => {
  return request({
    url: '/api/rb-core/core/oempolicy/oem_policy/policyDetailV2',
    method: 'get',
    params: {
      tenantId,
      userNo,
      userType,
      aisleCode
    }
  })
}

/* 租户详情 */
export const getTenantDetail = (tenantId) => {
  return request({
    url: '/api/rb-core/core/tenant/tenant/detail',
    method: 'get',
    params: {
      tenantId
    }
  })
}

/* 完成项 走审批 */
export const getFinish = (tenantId) => {
  return request({
    url: '/api/blade-system/tenant/finish',
    method: 'post',
    params: {
      tenantId
    }
  })
}

/* 发送短信修改密码 */
export const getUpdatePwdBySms = (tenantId) => {
  return request({
    url: '/api/rb-core/core/tenant/tenant/updatePwdBySms',
    method: 'get',
    params: {
      tenantId
    }
  })
}

/* 直接修改密码 */
export const getUpdatePwd = (tenantId, password) => {
  return request({
    url: '/api/rb-core/core/tenant/tenant/updatePwd',
    method: 'post',
    params: {
      tenantId,
      password
    }
  })
}